package com.aspose.cells;

class zaxb extends zaxa {
   private zut c;
   private int d;
   private int e;
   private short f;
   private short g;
   private zun h;
   private int i;
   private int j = -1;
   private int k = -1;
   private boolean l = false;
   private int m;
   private int n;
   private int o;
   private int p;
   private int q;
   private int r;
   private zfv s;
   private zagu t;

   public zaxb(zaay var1, zut var2, int var3, int var4, int var5, int var6) {
      super(var1);
      this.c = var2;
      this.d = var3;
      this.f = (short)var4;
      this.e = var5;
      this.g = (short)var6;
      this.q = this.f;
      this.r = this.g;
      this.m = var2.d(var3);
      if (this.m < 0) {
         this.m = -this.m - 1;
      }

      this.n = var2.d(var5);
      if (this.n < 0) {
         this.n = -this.n - 2;
      }

      if (this.n < this.m) {
         this.l = true;
         this.m = -1;
         this.n = -1;
         this.o = -1;
         this.p = -1;
      } else {
         zuq var7 = var2.b(this.m);
         this.o = var7.a() - this.d;
         if (this.n > this.m) {
            this.p = var2.b(this.n).a() - this.d;
         } else {
            this.p = this.o;
            this.h = var7.c(var4, var6);
         }

         this.i = this.m - 1;
      }

   }

   private zaxb(zaxb var1, zaay var2) {
      super(var2 == null ? var1.a : var2);
      this.c = var1.c;
      this.d = var1.d;
      this.f = var1.f;
      this.e = var1.e;
      this.g = var1.g;
      this.l = var1.l;
      this.m = var1.m;
      this.n = var1.n;
      this.o = var1.o;
      this.p = var1.p;
      this.q = var1.q;
      this.r = var1.r;
      this.s = var1.s;
      this.t = var1.t;
      this.i = var1.i;
   }

   public zahn b(zaay var1) {
      return new zaxb(this, var1);
   }

   public int c() {
      return this.e - this.d + 1;
   }

   public int d() {
      return this.g - this.f + 1;
   }

   public int e() {
      return this.c() * this.d();
   }

   public boolean l() {
      return false;
   }

   public boolean m() {
      return false;
   }

   public boolean n() {
      return false;
   }

   public zagu a(int var1, int var2) {
      if (var1 >= this.o && var1 <= this.p) {
         var2 += this.f;
         if (this.l) {
            if (var2 < this.q || var2 > this.r) {
               return zzk.a;
            }

            if (this.o == this.p && this.q == this.r) {
               return this.t;
            }
         }

         int var3 = this.c.d(var1 + this.d);
         return (zagu)(var3 < 0 ? zzk.a : this.a(this.c.b(var3), var2));
      } else {
         return zzk.a;
      }
   }

   public void f() {
      if (this.o >= 0) {
         if (this.o != this.p) {
            this.i = this.m;
            zuq var1 = this.c.b(this.i);
            this.j = var1.a();
            this.h = var1.c(this.q, this.r);
         } else {
            if (this.l && this.q == this.r) {
               this.i = -1;
            } else {
               this.h.b();
            }

         }
      }
   }

   public boolean b(int var1, int var2) {
      if (var1 > this.p) {
         this.i = this.n + 1;
         return false;
      } else if (var1 < this.o) {
         this.f();
         return this.g();
      } else {
         if (var1 == this.j) {
            if (var2 == this.k) {
               return true;
            }

            var2 += this.f;
            this.h.a(var2);
            this.s = this.h.a();
            if (this.s.c != 0) {
               this.k = this.s.a - this.f;
               this.t = null;
               return true;
            }

            if (this.C()) {
               return true;
            }

            ++this.i;
            if (var1 == this.p) {
               return false;
            }

            int var10000 = var1 + this.d;
         } else {
            var1 += this.d;
            this.i = this.c.d(var1);
            if (this.i < 0) {
               this.i = -this.i - 1;
               if (this.i > this.n) {
                  return false;
               }
            }
         }

         return this.D();
      }
   }

   public boolean a(int var1) {
      int var2 = this.d();
      int var3 = var1 % var2;
      int var4 = var1 / var2;
      return this.b(var4, var3);
   }

   private boolean C() {
      if (this.h.hasNext()) {
         this.s = this.h.a();
         if (this.s.c != 0) {
            this.k = this.s.a - this.f;
            this.t = null;
            return true;
         }
      }

      do {
         if (!this.h.hasNext()) {
            return false;
         }

         this.s = this.h.a();
      } while(this.s.c == 0);

      this.k = this.s.a - this.f;
      this.t = null;
      return true;
   }

   private boolean D() {
      zuq var1 = this.c.b(this.i);
      this.h = var1.c(this.q, this.r);
      if (this.C()) {
         this.j = var1.a() - this.d;
         return true;
      } else {
         ++this.i;

         while(this.i <= this.n) {
            var1 = this.c.b(this.i);
            this.h = var1.c(this.q, this.r);
            if (this.C()) {
               this.j = var1.a() - this.d;
               return true;
            }

            ++this.i;
         }

         return false;
      }
   }

   public boolean g() {
      if (this.i > this.n) {
         return false;
      } else if (this.i < 0) {
         this.i = this.n + 1;
         return true;
      } else if (this.C()) {
         return true;
      } else {
         ++this.i;
         return this.i > this.n ? false : this.D();
      }
   }

   public zagu h() {
      if (this.t == null) {
         this.t = zaaq.a(this.s, this.a);
      }

      return this.t;
   }

   public int i() {
      return this.j;
   }

   public int j() {
      return this.k;
   }

   public int k() {
      return this.j * (this.g - this.f + 1) + this.k;
   }

   public zahn b(int var1) {
      var1 += this.d;
      int var2 = this.c.d(var1 + this.d);
      return (zahn)(var2 < 0 ? new zawz((zagu)null, 9, 1, this.d()) : new zaxd(this.a, this.c.b(var2), this.f, this.g));
   }

   public zahn c(int var1) {
      return new zaxc(this.a, this.c, var1 + this.f, this.d, this.e);
   }

   public boolean q() {
      return this.l;
   }

   public int r() {
      if (!this.l) {
         this.E();
      }

      return this.o;
   }

   public int s() {
      if (!this.l) {
         this.E();
      }

      return this.p;
   }

   public int t() {
      if (!this.l) {
         this.E();
      }

      return this.q;
   }

   public int u() {
      if (!this.l) {
         this.E();
      }

      return this.r;
   }

   public int v() {
      if (!this.l) {
         this.E();
      }

      return this.o * (this.g - this.f + 1) + this.q;
   }

   public int w() {
      if (!this.l) {
         this.E();
      }

      return this.p * (this.g - this.f + 1) + this.r;
   }

   private void E() {
      this.l = true;
      this.q = this.g + 1;
      this.r = this.f - 1;
      this.o = -1;

      for(int var1 = this.m; var1 <= this.n; ++var1) {
         zuq var2 = this.c.b(var1);
         int var3;
         if (this.q > this.f) {
            this.b.a = this.f;
            var3 = var2.a(this.b, -1, (short)-1, true, false);
            if (var3 > -1) {
               if (this.q > this.b.a) {
                  this.q = this.b.a;
               }

               if (this.o < 0) {
                  this.o = var2.a();
                  this.m = var1;
               }

               this.p = var2.a();
               this.n = var1;
               if (this.r < this.g) {
                  short var4 = this.b.a;
                  this.b.a = this.g;
                  var2.a(this.b, var3, var4, true, true);
                  if (this.r < this.b.a) {
                     this.r = this.b.a;
                  }
               }
            }
         } else {
            this.b.a = this.g;
            var3 = var2.a(this.b, -1, (short)-1, true, true);
            if (var3 > -1) {
               if (this.r < this.b.a) {
                  this.r = this.b.a;
               }

               if (this.o < 0) {
                  this.o = var2.a();
                  this.m = var1;
               }

               this.p = var2.a();
               this.n = var1;
            }
         }
      }

      if (this.o < 0) {
         this.p = -1;
         this.q = -1;
         this.r = -1;
      } else {
         if (this.o == this.p && this.q == this.r) {
            this.s = this.c.b(this.o, this.q);
            this.t = zaaq.a(this.s, this.a);
         }

         this.o -= this.d;
         this.p -= this.d;
         this.q -= this.f;
         this.r -= this.f;
      }

   }
}
